package generated1.OneToMany.dao;
// default package
// Generated 9-apr-2009 16.21.53 by Hibernate Tools 3.2.2.GA

import generated1.OneToMany.Child;

import java.math.BigDecimal;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Home object for domain model class Child.
 * @see .Child
 * @author Hibernate Tools
 */
@Stateless
public class ChildHome {

	private static final Log log = LogFactory.getLog(ChildHome.class);

	@PersistenceContext
	private EntityManager entityManager;

	public void persist(Child transientInstance) {
		log.debug("persisting Child instance");
		try {
			entityManager.persist(transientInstance);
			log.debug("persist successful");
		} catch (RuntimeException re) {
			log.error("persist failed", re);
			throw re;
		}
	}

	public void remove(Child persistentInstance) {
		log.debug("removing Child instance");
		try {
			entityManager.remove(persistentInstance);
			log.debug("remove successful");
		} catch (RuntimeException re) {
			log.error("remove failed", re);
			throw re;
		}
	}

	public Child merge(Child detachedInstance) {
		log.debug("merging Child instance");
		try {
			Child result = entityManager.merge(detachedInstance);
			log.debug("merge successful");
			return result;
		} catch (RuntimeException re) {
			log.error("merge failed", re);
			throw re;
		}
	}

	public Child findById(BigDecimal id) {
		log.debug("getting Child instance with id: " + id);
		try {
			Child instance = entityManager.find(Child.class, id);
			log.debug("get successful");
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}
}
